<template>
    <div>
        <div class="crumbs">
            <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item :to="{ path: '/' }"><i class="el-icon-lx-cascades"></i> 系统首页</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        </div>
        <el-row>
            <el-col :span="24">
                <el-card class="box-card">
                    <div slot="header" class="clearfix">
                        <i class="el-icon-s-data"></i>
                        <span style="font-size: 18px;font-weight: 600;">经营数据</span>
                        <div style="float: right; padding: 3px 0" type="text">
                            <span>选择日期：
                                <el-date-picker v-model="starttime" type="date" placeholder="选择日期">
                                </el-date-picker>至
                                <el-date-picker v-model="endtime" type="date" placeholder="选择日期">
                                </el-date-picker>
                                <el-button type="primary" round style="margin-left: 20px;" @click="seek">筛选</el-button>
                            </span>
                        </div>
                    </div>
                    <Middle :childtime="endtime" ref="middle"></Middle>
                </el-card>
            </el-col>
        </el-row>
        <!-- 第二行 -->

        <el-row style="width: 100%;" justify="space-between" type="flex">
            <el-col :span="6">
                <Order ref="order" :childtime="endtime"></Order>
            </el-col>
            <el-col :span="6">
                <Rescue ref="rescue" :childtime="endtime"></Rescue>
            </el-col>
            <el-col :span="11">
                <Overview :childtime="endtime" ref="overview"></Overview>
            </el-col>
        </el-row>

        <!-- 第三行 -->
        <el-row>
            <el-col :span="24">

                <Analysis :childtime="endtime"></Analysis>
            </el-col>
        </el-row>
    </div>
</template>

<script>
// import { getrescuenum } from '@/api'
import Schart from 'vue-schart';
// import bus from '../common/bus';
import * as echarts from 'echarts';
import Analysis from './Dashboard/Analysis.vue';
import Order from './Dashboard/Order.vue';   //订单统计组件
import Rescue from './Dashboard/Rescue.vue';  //救援任务统计
import Middle from './Dashboard/Middle.vue';  //经营数据统计
import Overview from './Dashboard/Overview.vue' //用户概况统计
export default {
    // name: 'dashboard',
    data() {
        return {
            // name: localStorage.getItem('ms_username'),
            starttime: '',
            endtime: '',
        };
    },
    components: {
        Schart,
        Order,
        Rescue,
        Middle,
        Overview,
        Analysis
    },
    mounted() {
    },
    computed: {
        role() {
            return this.name === 'admin' ? '超级管理员' : '普通用户';
        },

    },

    methods: {
        changeDate() {
            const now = new Date().getTime();
            this.data.forEach((item, index) => {
                const date = new Date(now - (6 - index) * 86400000);
                item.name = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
            });
        },
        // 筛选事件
        seek() {
            this.$refs.order.handleechart1()
            // this.handleechart1(this.myChart)
            this.$refs.rescue.handleechart1()
            this.$refs.middle.handleechart1()
            this.$refs.overview.handleechart1()
        },

        // 渲染订单统计函数封装

    }
};
</script>


<style scoped>
::v-deep .el-card__body,
::v-deep .el-main {
    flex: 1 !important;
    height: 100%;
}

::v-deep .myel-card__body {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 230px;
}

::v-deep .myel-card__body>div {
    width: 25%;
}

::v-deep .clearfix span {
    font-size: 18px;
    font-weight: 600;
}

::v-deep .mytext {
    color: white;
    margin-left: 30px;
}

::v-deep .mytext p {
    margin-bottom: 20px;
    font-size: 20px;
}

::v-deep .myicon {
    font-size: 40px;
    color: white;
    position: absolute;
    right: 20px;
}

::v-deep .el-row {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
}

::v-deep .grid-content {
    display: flex;
    align-items: center;
    height: 100%;
    position: relative;


}

::v-deep .grid-cont-right {
    flex: 1;
    text-align: center;
    font-size: 14px;
    color: #999;
}

::v-deep .grid-num {
    font-size: 30px;
    font-weight: bold;
}

::v-deep .grid-con-icon {
    font-size: 50px;
    width: 100px;
    height: 100px;
    text-align: center;
    line-height: 100px;
    color: #fff;
}

::v-deep .grid-con-1 .grid-con-icon {
    background: rgb(45, 140, 240);
}

::v-deep .grid-con-1 .grid-num {
    color: rgb(45, 140, 240);
}

::v-deep .grid-con-2 .grid-con-icon {
    background: rgb(100, 213, 114);
}

::v-deep .grid-con-2 .grid-num {
    color: rgb(45, 140, 240);
}

::v-deep .grid-con-3 .grid-con-icon {
    background: rgb(242, 94, 67);
}

::v-deep .grid-con-3 .grid-num {
    color: rgb(242, 94, 67);
}

.user-info {
    display: flex;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #ccc;
    margin-bottom: 20px;
}

::v-deep .user-info-list {
    font-size: 14px;
    color: #999;
    line-height: 25px;
}

.user-info-list span {
    margin-left: 70px;
}

.mgb20 {
    margin-bottom: 20px;
}

.todo-item {
    font-size: 14px;
}

.todo-item-del {
    text-decoration: line-through;
    color: #999;
}

.schart {
    width: 100%;
    height: 300px;
}

.text {
    font-size: 14px;
}

.item {
    margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
    display: table;
    content: "";
}

.clearfix:after {
    clear: both
}

::v-deep .box-card {
    width: 100%;
    margin-bottom: 20px;
    height: 100%;
}

.el-icon-s-data {
    font-size: 20px;
    color: blue;
    border: 1px solid blue;
}
</style>
